home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / SCGetDataTypes.z / SCGetDataTypes
Text File  |  1998-10-30  |  11KB  |  265 lines

  1.  
  2.  
  3.  
  4. SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((3333))))                IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                 SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      SCGetDataTypes - determine the data types supported by a scanner
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccaaaannnnnnnneeeerrrr....hhhh>>>>
  14.  
  15.      iiiinnnntttt SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((SSSSCCCCAAAANNNNNNNNEEEERRRR ****ssss,,,, SSSSCCCCDDDDAAAATTTTAAAATTTTYYYYPPPPEEEE ********ddddtttt,,,, iiiinnnntttt ****nnnnttttyyyyppppeeeessss))));;;;
  16.  
  17. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      _S_C_G_e_t_D_a_t_a_T_y_p_e_s sets *_d_t to point to an array of the data types supported
  19.      by the scanner driver.  *_n_t_y_p_e_s gets the number of data types pointed to
  20.      by *_d_t.  _s specifies a connection to a scanner driver obtained from a
  21.      call to _S_C_O_p_e_n(3), _S_C_O_p_e_n_F_i_l_e(3), or _S_C_O_p_e_n_S_c_r_e_e_n(3).
  22.  
  23.      _S_C_D_A_T_A_T_Y_P_E is defined in <_s_c_a_n_n_e_r._h> as follows:
  24.  
  25.           typedef struct tag_scdatatype {
  26.               unsigned int packing : 4;
  27.               unsigned int channels : 4;
  28.               unsigned int type : 8;
  29.               unsigned int bpp : 8;
  30.           } SCDATATYPE;
  31.  
  32.  
  33.      _p_a_c_k_i_n_g indicates how the data for each pixel is laid out.  Its value
  34.      will be one of SSSSCCCC____PPPPAAAACCCCKKKKPPPPIIIIXXXX, SSSSCCCC____PPPPAAAACCCCKKKKBBBBAAAANNNNDDDD, or SSSSCCCC____PPPPAAAACCCCKKKKPPPPLLLLAAAANNNNEEEE, which are
  35.      defined in <_s_c_a_n_n_e_r._h>.  If _p_a_c_k_i_n_g is SSSSCCCC____PPPPAAAACCCCKKKKPPPPIIIIXXXX, then all the data for
  36.      each pixel is together.  If _p_a_c_k_i_n_g is SSSSCCCC____PPPPAAAACCCCKKKKBBBBAAAANNNNDDDD then the data is
  37.      banded by row, and if _p_a_c_k_i_n_g is SSSSCCCC____PPPPAAAACCCCKKKKPPPPLLLLAAAANNNNEEEE then the data is laid out
  38.      in planes (see below).
  39.  
  40.      _c_h_a_n_n_e_l_s is the number of channels of data for this type.  Black and
  41.      white data (SSSSCCCC____MMMMOOOONNNNOOOO, SSSSCCCC____GGGGRRRREEEEYYYY) consists of one channel, while color data
  42.      consists of three (SSSSCCCC____RRRRGGGGBBBB, SSSSCCCC____CCCCMMMMYYYY) or four (SSSSCCCC____CCCCMMMMYYYYKKKK).
  43.  
  44.      _t_y_p_e is used to interpret the channels of data.  _t_y_p_e should be one of
  45.      SSSSCCCC____MMMMOOOONNNNOOOO, SSSSCCCC____GGGGRRRREEEEYYYY, SSSSCCCC____RRRRGGGGBBBB, SSSSCCCC____CCCCMMMMYYYY, or SSSSCCCC____CCCCMMMMYYYYKKKK, which are defined in
  46.      <_s_c_a_n_n_e_r._h>.
  47.  
  48.      _b_p_p is the number of bits per pixel in each channel.  Thus, for
  49.      monochrome data, there is 1 bit per pixel, and for 24 bit RGB color,
  50.      there are 8 bits per pixel (* 3 channels == 24 bits).
  51.  
  52.    SSSSCCCCDDDDAAAATTTTAAAATTTTYYYYPPPPEEEE IIIIlllllllluuuussssttttrrrraaaattttiiiioooonnnn
  53.      Suppose _t_y_p_e is SSSSCCCC____RRRRGGGGBBBB, and _b_p_p is 8.  In this case _c_h_a_n_n_e_l_s must be 3
  54.      (because _t_y_p_e is SSSSCCCC____RRRRGGGGBBBB), and the data is 24 bit per pixel color data.
  55.  
  56.      Further suppose that our image data consists of 4 rows of 4 pixels each.
  57.      In the illustrations that follow, an RRRR represents one byte of red data, a
  58.      GGGG represents one byte of green data, and a BBBB represents one byte of blue
  59.      data.  The value of _p_a_c_k_i_n_g affects the layout of the image data as
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((3333))))                IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                 SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((3333))))
  71.  
  72.  
  73.  
  74.      folows:
  75.  
  76.    _p_a_c_k_i_n_g == SSSSCCCC____PPPPAAAACCCCKKKKPPPPIIIIXXXX
  77.      In this case, the pixel values for each channel will be together in each
  78.      row.
  79.  
  80.           RGBRGBRGBRGB
  81.           RGBRGBRGBRGB
  82.           RGBRGBRGBRGB
  83.           RGBRGBRGBRGB
  84.  
  85.  
  86.    _p_a_c_k_i_n_g == SSSSCCCC____BBBBAAAANNNNDDDDEEEEDDDD
  87.      In this case, the red, green and blue channels of pixel data will be
  88.      separated by row.
  89.  
  90.           RRRR
  91.           GGGG
  92.           BBBB
  93.           RRRR
  94.           GGGG
  95.           BBBB
  96.           RRRR
  97.           GGGG
  98.           BBBB
  99.           RRRR
  100.           GGGG
  101.           BBBB
  102.  
  103.  
  104.    _p_a_c_k_i_n_g == SSSSCCCC____PPPPAAAACCCCKKKKPPPPLLLLAAAANNNNEEEE
  105.      All the red data for the entire image is first, followed by all the green
  106.      data, followed by all the blue data.
  107.  
  108.           RRRR
  109.           RRRR
  110.           RRRR
  111.           RRRR
  112.           RRRR
  113.           GGGG
  114.           GGGG
  115.           GGGG
  116.           GGGG
  117.           BBBB
  118.           BBBB
  119.           BBBB
  120.           BBBB
  121.           BBBB
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((3333))))                IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                 SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((3333))))
  137.  
  138.  
  139.  
  140.    DDDDaaaattttaaaa TTTTyyyyppppeeee CCCCoooonnnnvvvveeeennnnttttiiiioooonnnnssss
  141.      Scanner applications need not be written to support all possible data
  142.      types.  There are four basic data types that are typically used:
  143.  
  144.           MMMMoooonnnnoooocccchhhhrrrroooommmmeeee:
  145.           _p_a_c_k_i_n_g == SSSSCCCC____PPPPAAAACCCCKKKKPPPPIIIIXXXX
  146.           _c_h_a_n_n_e_l_s == 1
  147.           _t_y_p_e == SSSSCCCC____MMMMOOOONNNNOOOO
  148.           _b_p_p == 1
  149.  
  150.  
  151.      ALL scanner drivers MUST support MMMMoooonnnnoooocccchhhhrrrroooommmmeeee format.
  152.  
  153.           8888 BBBBiiiitttt GGGGrrrreeeeyyyyssssccccaaaalllleeee:
  154.           _p_a_c_k_i_n_g == SSSSCCCC____PPPPAAAACCCCKKKKPPPPIIIIXXXX
  155.           _c_h_a_n_n_e_l_s == 1
  156.           _t_y_p_e == SSSSCCCC____GGGGRRRREEEEYYYY
  157.           _b_p_p == 8
  158.  
  159.  
  160.      All scanner drivers that support any kind of greyscale or color output
  161.      MUST support 8888 BBBBiiiitttt GGGGrrrreeeeyyyyssssccccaaaalllleeee format.
  162.  
  163.      For color output, there are two possible situations when dealing with
  164.      well-behaved scanner drivers.  One is that the red, green, and blue
  165.      channels are scanned in three seperate passes; in this case, the data
  166.      type is:
  167.  
  168.           PPPPllllaaaannnnaaaarrrr 22224444 bbbbiiiitttt RRRRGGGGBBBB ccccoooolllloooorrrr:
  169.           _p_a_c_k_i_n_g == SSSSCCCC____PPPPAAAACCCCKKKKPPPPLLLLAAAANNNNEEEE
  170.           _c_h_a_n_n_e_l_s == 3
  171.           _t_y_p_e == SSSSCCCC____RRRRGGGGBBBB
  172.           _b_p_p == 8
  173.  
  174.  
  175.      The other situation is a one-pass color scanner that gets all of the data
  176.      in one pass.  The data type for color data from this kind of scanner is:
  177.  
  178.           PPPPaaaacccckkkkeeeedddd 22224444 bbbbiiiitttt RRRRGGGGBBBB ccccoooolllloooorrrr:
  179.           _p_a_c_k_i_n_g == SSSSCCCC____PPPPAAAACCCCKKKKPPPPIIIIXXXX
  180.           _c_h_a_n_n_e_l_s == 3
  181.           _t_y_p_e == SSSSCCCC____RRRRGGGGBBBB
  182.           _b_p_p == 8
  183.  
  184.  
  185.      A scanning application that is prepared to deal with these four data
  186.      types should be able to interact well with any well-behaved scanner
  187.      driver.
  188.  
  189.      For information on setting the data type for scanning, see _S_C_S_e_t_u_p(3).
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((3333))))                IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo                 SSSSCCCCGGGGeeeettttDDDDaaaattttaaaaTTTTyyyyppppeeeessss((((3333))))
  203.  
  204.  
  205.  
  206. RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
  207.      _S_C_G_e_t_D_a_t_a_T_y_p_e_s returns 0 if successful.  If an error occurs, -1 is
  208.      returned and _S_C_e_r_r_n_o is set to indicate the reason for failure.
  209.  
  210. EEEEXXXXEEEECCCCUUUUTTTTIIIIOOOONNNN EEEERRRRRRRROOOORRRR CCCCOOOODDDDEEEESSSS
  211.      _S_C_G_e_t_D_a_t_a_T_y_p_e_s will fail under the following circumstances.
  212.  
  213.      SCEDEV                   Scanner driver error
  214.  
  215.      SCECOMM                  Error communicating with scanner driver
  216.  
  217. WWWWAAAARRRRNNNNIIIINNNNGGGG
  218.      The memory pointed to by *_d_t after a call to _S_C_G_e_t_D_a_t_a_T_y_p_e_s belongs to
  219.      _l_i_b_s_c_a_n(3) and should not be modified by the calling program.  Nor should
  220.      any assumptions be made about its values after subsequent calls to
  221.      _S_C_G_e_t_D_a_t_a_T_y_p_e_s; in other words, it should be copied to memory owned by
  222.      the calling program before future calls to _S_C_G_e_t_D_a_t_a_T_y_p_e_s.
  223.  
  224. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  225.      _l_i_b_s_c_a_n(3), _S_C_O_p_e_n(3), _S_C_S_e_t_u_p(3).
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.